<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>流程列表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="流程,列表">
	<meta http-equiv="description" content="This is my page">
	
	<style type="text/css">
	</style>
	
  </head>
  
  <body>
    <center>
    	<div id="flowListDiv" style="display:inline-block; width:100%;">
	    	<s:form name="frm" id="frm" method="post" action="flowList" namespace="/inner/flow">
	    		<s:hidden name="wfvo.moduleId" id="fmId"></s:hidden>
	    		
	    		<table cellspacing="0" width="100%">
					<tr>
						<td align="left">
							<input type="button" value="新增" class="btn" onclick="toAddFlow()"/>
						</td>
					</tr>
				</table>
				
	    		<table cellspacing="1" cellpadding="3" width="100%" bgcolor="#CCCCCC">
	    			<tr align="center" class="tableHead">
	    				<td width="10%">
	    					序号
	    				</td>
	    				<td width="30%">
	    					流程名称
	    				</td>
	    				<td width="20%">
	    					创建时间
	    				</td>
	    				<td width="20%">
	    					最后修改时间
	    				</td>
	    				<td width="20%">
	    					操作
	    				</td>
	    			</tr>
	    			<s:iterator value="lp.list" status="s">
	    				<tr align="center"<s:if test="#s.index%2==0">class="tableRow2" onMouseMove="this.className='tableRow3'" onMouseOut="this.className='tableRow2'"</s:if>
							<s:else>class="tableRow1" onMouseMove="this.className='tableRow3'" onMouseOut="this.className='tableRow1'"</s:else>
	    				>
	    					<td>
	    						<s:property value="(pager.thisPage - 1) * pager.pageSize + #s.index + 1" />
	    					</td>
	    					<td>
	    						<s:property value="flowName" />
	    					</td>
	    					<td>
	    						<s:date name="createTime" format="yyyy-MM-dd" />
	    					</td>
	    					<td>
	    						<s:date name="lastModifyTime" format="yyyy-MM-dd" />
	    					</td>
	    					<td>
	    						<a href="javascript:toUpdateFlow('<s:property value="id" />')">修改</a>
	    						<a href="javascript:delFlow('<s:property value="id" />')">删除</a>
	    					</td>
	    				</tr>
	    			</s:iterator>
	    			<jsp:include page="/common/pager/pager.jsp">
						<jsp:param name="formName" value="frm" />
						<jsp:param name="id" value="1" />
					</jsp:include>
	    		</table>
	    	</s:form>
    	</div>
    </center>
    
    <script type="text/javascript">
    $(function(){
    	var pFrame = parent.$('#mainFrame');
    	if(pFrame != null)
    	{
    		var flowListDiv = $('#flowListDiv');
    		pFrame.height(parseInt(flowListDiv.height(), 10) + 20);
    	}
    });
    
    function toAddFlow()
    {
        var fmId = $('#fmId');
        var url = realPath + '/inner/flow/toAddFlow.action?wf.flowModule.id=' + fmId.val();
        openWin(url, 1000, 700, 'yes', 'yes');
    }

    function toUpdateFlow(id)
    {
        var url = realPath + '/inner/flow/toUpdateFlow.action?wf.id=' + id;
        openWin(url, 1000, 700, 'yes', 'yes');
    }

    function delFlow(id)
    {
    	var url = 'inner/flow/delFlow.action?wf.id=' + id;
    	showConfirm('确认删除？', function(v){
        	if(v == true)
        	{
            	ajaxAction(url, 'get', 'frm', false, function(){
            		searchThis();
				});
        	}
        });
    }

    function searchThis()
    {
    	$('#thisPage').val(1);
        $('#frm').submit();
    }
    </script>
  </body>
</html>
